# import pandas as pd
#
# a = ['线索名称', '数据来源', '手机', '电话', '地址', '邮箱', '客户级别', '客户行业', '备注', '单行文本', '单行文本1']
#
# data_df = pd.DataFrame()
#
# for i in a:
#     data_df[i] = ""
#
# writer = pd.ExcelWriter('movie_top250.xlsx')
# data_df.to_excel(writer)
# writer.save()
#

def index_title(index):
    a = ['A','B','C','D','E','F','G','H','I','G','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
    return a[index]


import xlsxwriter

files_name = "test66666.xls"
workbook = xlsxwriter.Workbook(files_name)
worksheet = workbook.add_worksheet("Sheet1")
a =['线索名称', '数据来源', '手机', '电话', '地址', '邮箱', '客户级别', '客户行业', '备注', '单行文本', '单行文本1']
index = 0
for x in a:
    if x == '客户行业':
        pass
    if x == '客户级别':
        print(index)
        for j in range(10000):
            worksheet.data_validation(index_title(index) + str(j+2), {'validate': 'list', 'source': ["A", "B", "C"]})
    worksheet.write(0,index,x)
    index += 1
workbook.close()


# def write_with_dropdown(book_name, sheet_name="Sheet1",**kwargs):
#     # 官网https://xlsxwriter.readthedocs.io/ 写入下拉列表
#     workbook = xlsxwriter.Workbook(book_name)
#     worksheet = workbook.add_worksheet(sheet_name)
#     worksheet.data_validation("A2", {'validate': 'list', 'source': kwargs.get('list')})
#     workbook.close()
#
# write_with_dropdown('test1.xlsx',list=['A','B','C'])

